import java.util.Scanner;

public class Test20230809_3 {
    public static void move(char p1,char p2){
        System.out.print(p1+"->"+p2+" ");
        return;
    }
    public static void hanoi(int n, char p1,char p2,char p3){
        if(n==1){
            move(p1,p3);
            return ;
        }
        hanoi(n-1, p1,p3,p2);
        move(p1,p3);
        hanoi(n-1,p2,p1,p3);
    }
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        hanoi(n,'A','B','C');

    }
}
